const { Schema, model} = require('mongoose');
// 1.设置集合结构
const studentsSchema = new Schema({
  name: String,
  age: String,
  gender: String,
  subjectsId:{
    type: Schema.Types.ObjectId,
    ref:'subjectsModel',//设置需要关联的集合的模型名称
  },
  classesId:{
    type: Schema.Types.ObjectId,
    ref: 'classesModel'
  },
},{ versionKey:false});
//2.设置数据模型，同时连接数据集合
module.exports.studentsModel = model('studentsModel',studentsSchema,'students');